package web.protocols.action;

import com.opensymphony.xwork2.ActionSupport;
import domain.entities.Protocolo;
import domain.entities.ProtocoloCompromisopais;
import domain.entities.Protocolscorecard;
import domain.entities.ScorecardConfiguration;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import services.ProtocolCRUDService;
import services.exceptions.NoProtocoloCompromisopaisSelectedException;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: Guillermo
 * Date: 02/11/12
 * Time: 16:18
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/Protocols/Vendor")
public class ProtocolVendorController  extends ActionSupport {

    private ProtocolCRUDService protocolCRUDService;

    @Autowired
    public ProtocolVendorController(ProtocolCRUDService protocolCRUDService) {
        this.protocolCRUDService = protocolCRUDService;
    }

    @Action(value="main", results={
            @Result(name="success",location="/protocols.vendorglobal.tiles", type="tiles")
    })
    public String execute() {

        Protocolo aux = null;
        try {
            aux = protocolCRUDService.recoverProtocolo();
        } catch (NoProtocoloCompromisopaisSelectedException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        if(aux == null)
            return null;

        return SUCCESS;
    }
}
